
#include <iostream>
#include <string>

using namespace std;

#include <wrapper.hpp>

int main(int argc, char **argv)
{
	std::string first = "cid_to_url_7";
	if(argc >= 2)
		first = argv[1];
	std::string second = "cid_to_url_5,,1210063291484234";
	if(argc >= 3)
		second = argv[2];

	cout << "test with \"" << first << "\" and \"" << second << "\"" << endl;

	cout << "std::string <" << ( first < second ) << endl;
	cout << "std::string <=" << ( first <= second ) << endl;
	cout << "std::string >" << ( first > second ) << endl;
	cout << "std::string >=" << ( first >= second ) << endl;
	cout << "std::string ==" << ( first == second ) << endl;
	cout << "std::string !=" << ( first != second ) << endl;

	typedef xbase::string_wrapper<unsigned int, char, kb::network_byteorder> string_type;
	char first_buf[1024] = {0};
	char second_buf[1024] = {0};

	string_type *first_str = reinterpret_cast<string_type*>(first_buf);
	string_type *second_str = reinterpret_cast<string_type*>(second_buf);

	first.copy(first_str->data(), first.size());
	first_str->set_size(first.size());

	second.copy(second_str->data(), second.size());
	second_str->set_size(second.size());

	cout << "string_wrapper <" << ( *first_str < *second_str ) << endl;
	cout << "string_wrapper <=" << ( *first_str <= *second_str ) << endl;
	cout << "string_wrapper >" << ( *first_str > *second_str ) << endl;
	cout << "string_wrapper >=" << ( *first_str >= *second_str ) << endl;
	cout << "string_wrapper ==" << ( *first_str == *second_str ) << endl;
	cout << "string_wrapper !=" << ( *first_str != *second_str ) << endl;

	cout << "std::string string_wrapper <" << ( first < *second_str ) << endl;
	cout << "std::string string_wrapper <=" << ( first <= *second_str ) << endl;
	cout << "std::string string_wrapper >" << ( first > *second_str ) << endl;
	cout << "std::string string_wrapper >=" << ( first >= *second_str ) << endl;
	cout << "std::string string_wrapper ==" << ( first == *second_str ) << endl;
	cout << "std::string string_wrapper !=" << ( first != *second_str ) << endl;

	cout << "string_wrapper std::string <" << ( *first_str < second ) << endl;
	cout << "string_wrapper std::string <=" << ( *first_str <= second ) << endl;
	cout << "string_wrapper std::string >" << ( *first_str > second ) << endl;
	cout << "string_wrapper std::string >=" << ( *first_str >= second ) << endl;
	cout << "string_wrapper std::string ==" << ( *first_str == second ) << endl;
	cout << "string_wrapper std::string !=" << ( *first_str != second ) << endl;

	return 0;
}
